<?php echo $header; ?>
<div id="content">
  <div class="breadcrumb">
    <?php foreach ($breadcrumbs as $breadcrumb) { ?>
    <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
    <?php } ?>
  </div>
  <?php if ($error_warning) { ?>
  <div class="warning"><?php echo $error_warning; ?></div>
  <?php } ?>
  <?php if ($success) { ?>
  <div class="success"><?php echo $success; ?></div>
  <?php } ?>
  <div class="box">
    <div class="heading">
      <h1><img src="view/image/customer.png" alt="" /> <?php echo $heading_title; ?></h1>
      <div class="buttons"><a href="<?php echo $insert; ?>" class="button"><?php echo $button_insert; ?></a><a onclick="document.getElementById('form').submit();" class="button"><?php echo $button_delete; ?></a></div>
    </div>
    <div class="content">
      <form action="<?php echo $delete; ?>" method="post" enctype="multipart/form-data" id="form">
        <table class="list">
          <thead>
            <tr>
              <td width="1" style="text-align: center;">
                  <input type="checkbox" onclick="$('input[name*=\'selected\']').attr('checked', this.checked);" /></td>
                <td class="left"><?php if ($sort == 'nickname') { ?>
                        <a href="<?php echo $sort_nickname; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_nickname; ?></a>
                    <?php } else { ?>
                        <a href="<?php echo $sort_nickname; ?>"><?php echo $column_nickname; ?></a>
                    <?php } ?>
                </td>
                <td class="left">
                    <?php if ($sort == 'name') { ?>
                        <a href="<?php echo $sort_name; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_name; ?></a>
                    <?php } else { ?>
                        <a href="<?php echo $sort_name; ?>"><?php echo $column_name; ?></a>
                    <?php } ?>
                </td><td class="left"><?php if ($sort == 'telephone') { ?>
                        <a href="<?php echo $sort_telephone; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_telephone; ?></a>
                    <?php } else { ?>
                        <a href="<?php echo $sort_telephone; ?>"><?php echo $column_telephone; ?></a>
                    <?php } ?>
                </td>
                <td class="left"><?php if ($sort == 'sex') { ?>
                        <a href="<?php echo $sort_sex; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_sex; ?></a>
                    <?php } else { ?>
                        <a href="<?php echo $sort_sex; ?>"><?php echo $column_sex; ?></a>
                    <?php } ?>
                </td>
                <td class="left"><?php if ($sort == 'province') { ?>
                        <a href="<?php echo $sort_province; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_province; ?></a>
                    <?php } else { ?>
                        <a href="<?php echo $sort_province; ?>"><?php echo $column_province; ?></a>
                    <?php } ?>
                </td>
                <td class="left"><?php if ($sort == 'city') { ?>
                        <a href="<?php echo $sort_city; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_city; ?></a>
                    <?php } else { ?>
                        <a href="<?php echo $sort_city; ?>"><?php echo $column_city; ?></a>
                    <?php } ?>
                </td>
                <td class="left"><?php if ($sort == 'country') { ?>
                        <a href="<?php echo $sort_country; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_country; ?></a>
                    <?php } else { ?>
                        <a href="<?php echo $sort_country; ?>"><?php echo $column_country; ?></a>
                    <?php } ?>
                </td>

                <td class="left"><?php if ($sort == 'subscribe') { ?>
                        <a href="<?php echo $sort_subscribe; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_subscribe; ?></a>
                    <?php } else { ?>
                        <a href="<?php echo $sort_subscribe; ?>"><?php echo $column_subscribe; ?></a>
                    <?php } ?>
                </td>
                <td class="left"><?php if ($sort == 'share_status') { ?>
                        <a href="<?php echo $sort_share_status; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_share_status; ?></a>
                    <?php } else { ?>
                        <a href="<?php echo $sort_share_status; ?>"><?php echo $column_share_status; ?></a>
                    <?php } ?>
                </td>
                <td class="left"><?php if ($sort == 'date_added') { ?>
                        <a href="<?php echo $sort_date_added; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_date_added; ?></a>
                    <?php } else { ?>
                        <a href="<?php echo $sort_date_added; ?>"><?php echo $column_date_added; ?></a>
                    <?php } ?>
                </td>
                <td class="left"><?php if ($sort == 'lottery_times') { ?>
                        <a href="<?php echo $sort_lottery_times; ?>" class="<?php echo strtolower($order); ?>"><?php echo $column_lottery_times; ?></a>
                    <?php } else { ?>
                        <a href="<?php echo $sort_lottery_times; ?>"><?php echo $column_lottery_times; ?></a>
                    <?php } ?>
                </td>
                <td class="left"><?php echo $column_action; ?></a></td>
            </tr>
          </thead>
          <tbody>
            <?php if ($wechats) { ?>
            <?php foreach ($wechats as $wechat) { ?>
            <tr>
                <td style="text-align: center;"><?php if ($wechat['selected']) { ?>
                    <input type="checkbox" name="selected[]" value="<?php echo $wechat['openid']; ?>" checked="checked" />
                <?php } else { ?>
                    <input type="checkbox" name="selected[]" value="<?php echo $wechat['openid']; ?>" />
                <?php } ?>
                </td>
                <td class="left"><?php echo $wechat['nickname']; ?></td>
                <td class="left"><?php echo $wechat['name']; ?></td>
                <td class="left"><?php echo $wechat['telephone']; ?></td>
                <td class="left"><?php echo $wechat['sex']; ?></td>
                <td class="left"><?php echo $wechat['province']; ?></td>
                <td class="left"><?php echo $wechat['city']; ?></td>
                <td class="left"><?php echo $wechat['country']; ?></td>
                <td class="left"><?php echo $wechat['subscribe']; ?></td>
                <td class="left"><?php echo $wechat['share_status']; ?></td>
                <td class="left"><?php echo $wechat['date_added']; ?></td>
                <td class="left"><?php echo $wechat['lottery_times']; ?></td>
                <td class="left"><?php foreach ($wechat['action'] as $action) { ?>
                        [ <a href="<?php echo $action['href']; ?>"><?php echo $action['text']; ?></a> ]
                    <?php } ?></td>
            </tr>
            <?php } ?>
            <?php } else { ?>
            <tr>
              <td class="center" colspan="8"><?php echo $text_no_results; ?></td>
            </tr>
            <?php } ?>
          </tbody>
        </table>
      </form>
      <div class="pagination"><?php echo $pagination; ?></div>
    </div>
  </div>
</div>
<?php echo $footer; ?>